<?php

Class CaiModel extends Model {

    protected $_map = array(
        'id'       => 'cai_id',
    );
    protected $_validate = array(
            //array('cai_thumb,cai_id', 'checksss', '今天已经购买过，请明天再来', 1, 'callback', 3),
    );

    function checksss() {
        dump($_POST);
        exit;
    }

    protected $_auto = array(
        array('cai_shop_id', 'get_shop', 1, 'callback'),
        array('cai_owner_id', 'get_uid', 1, 'callback'),
        array('cai_price', 'get_price', 3, 'callback'),
        array('dateline', 'time', 1, 'function'),
    );

    public function get_shop() {
        return session("shop_id");
    }

    public function get_uid() {
        return session("uid");
    }

    public function get_price() {
        return intval($_POST['cai_price'] * 100);
    }

}

?>
